fix: preserve file parts in subtask prompts for multimodal subagents#20021
Closed
cyberprophet wants to merge 2 commits into
Closed
fix: preserve file parts in subtask prompts for multimodal subagents#20021cyberprophet wants to merge 2 commits into
cyberprophet wants to merge 2 commits into
Conversation
When `isSubtask` is true, the prompt assembly logic discards all non-text parts from `input.parts`, including images and PDFs passed as content blocks. This makes multimodal subagents like multimodal-looker unable to receive any visual content — the agent gets only the text instruction with no image data attached. Preserve `input.parts` entries with `type === "file"` alongside the subtask part so that vision-capable subagents can analyze images passed through tools like `look_at`. Closes anomalyco#20001 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Collaborator
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #20001
Type of change
What does this PR do?
When
isSubtaskis true inprompt.ts, the prompt assembly discards all non-text parts frominput.parts. This means file content blocks (images, PDFs) passed by callers like thelook_attool are silently dropped before the subagent ever sees them.The fix adds one line: filter
input.partsfortype === "file"entries and append them after the subtask part. The existingtoModelMessagesinmessage-v2.tsalready handles file parts in user messages (lines 655-668), so no other changes are needed.I hit this while building a plugin that delegates product image analysis to
multimodal-looker. The agent always responded with "Could not access the image file" because the image content block was stripped. Traced it to theisSubtaskgate atprompt.ts:1927-1942. The existing TODO comment on line 1938 acknowledges this gap.How did you verify your code works?
bun test test/session/)bun turbo typecheck)look_atwith a product image →multimodal-lookerreceived the image and returned structured analysisScreenshots / recordings
N/A — not a UI change.
Checklist